package org.simpleframework.mvc.type;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * 存储http请求路径和请求方法 ,创建映射存储是,需要使用该对象作为key,于是该对象必须实现hashcode和equals方法--map中对象做为key的必要原则 或者使用lombok注解@Data
 *
 * @author: Oliver
 * @time: 2020/12/30/20:17
 */
@Getter
@Setter
@AllArgsConstructor
public class RequestPathInfo {

    // http请求路径
    private String path;
    // http请求方法
    private String method;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RequestPathInfo that = (RequestPathInfo) o;
        return path.equals(that.path) &&
                method.equals(that.method);
    }

    @Override
    public int hashCode() {
        return Objects.hash(path, method);
    }
}
